﻿using MvcContrib.UI.Grid;

namespace ToyStore.Web.Mvc.Common
{
	/// <summary>
	/// Klasa dzięki, której mamy możliwość budowania grida bez nagłówka.
	/// </summary>
	/// <typeparam name="T"></typeparam>
	public class GridNoHeaderRenderer<T> :
		HtmlTableGridRenderer<T> where T : class
	{
		/// <summary>
		/// Renderowania nagłówka.
		/// </summary>
		/// <returns></returns>
		protected override bool RenderHeader()
		{
			// Explicitly returning true would suppress the header
			// just fine, however, Render() will always assume that
			// items exist in collection and RenderEmpty() will
			// never be called.  
			// In other words, return ShouldRenderHeader() if you
			// want to maintain the Empty text when no items exist.
			return ShouldRenderHeader();
		}
	}
}